﻿using DevExpress.XtraEditors.Controls;
using ExRichTextBox;
using RecruitStudents.Client.BLL;
using RecruitStudents.Utility;
using RecruitStudents.Utility.Const;
using RecruitStudents.Utility.Helper;
using RecruitStudents.Utility.Json;
using RecruitStudents.Utility.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RecruitStudents.Client.Examinee
{
    public partial class Examinee_ExameeDetailForm : BaseForm
    {
        ServiceExaminee service = new ServiceExaminee();
        ServiceConsult serviceConsult = new ServiceConsult();
        ServiceComm bllCommService = new ServiceComm();
        public string strNMT_SignUpID = "";
        public string strIdentityCard = "";
        public string strSignUpID = "";
        public string strType = "";

        private int selectStart1 = 0;
        private string strMsgID;
        private string strUsersNickName;
        //系统是否运行
        private bool isRun = false;//是否有数据
        private int imgIconIndex = 0;

        public Examinee_ExameeDetailForm()
        {
            InitializeComponent();
        }

        public void Run()
        {
            InitData();
            //// txtNMT_SignUpID.Focus();//高考报名号
            this.Show();
        }

        #region 页面初始化
        private void InitData()
        {
            LoadInfo();//基本信息
            BindSpecialityList();//专业信息
            BindPayFeeList();//缴费信息
            BindNoticeList();//绑定通知列表

            BindConsultResorce();
            strMsgID = "";
            strUsersNickName = "";

            BoundMsgList(string.Empty);

        }
        #endregion

        #region 绑定考生基本信息
        private void LoadInfo()
        {
            if (strType == "Look")
            {
                btnModify.Visible = false;
                btnSave.Visible = false;
                btnModifyAdvanced.Visible = false;
                btnSaveAdvanced.Visible = false;
            }
            else if (strType == "Siged")
            {
                btnModifyAdvanced.Visible = false;
                btnSaveAdvanced.Visible = false;
            }
            #region 绑定生源地下拉列表框
            DataTable dtExamProvince = bllCommService.GetDicDataTableByDicTableName("TB_Dic_ExamProvince");
            comboExamProvince.Properties.Columns.Clear();
            comboExamProvince.Properties.Columns.Add(new LookUpColumnInfo("DicNO", 30, "生源地代码"));
            comboExamProvince.Properties.Columns.Add(new LookUpColumnInfo("DicName", 55, "生源地名称"));
            comboExamProvince.Properties.ValueMember = "DicNO";
            comboExamProvince.Properties.DisplayMember = "DicName";
            comboExamProvince.Properties.DataSource = dtExamProvince;
            comboExamProvince.Properties.NullText = "";
            #endregion

            #region 绑定民族下拉列表框
            DataTable dtNation = bllCommService.GetDicDataTableByDicTableName("TB_Dic_Nation");
            comboNation.Properties.Columns.Clear();
            comboNation.Properties.Columns.Add(new LookUpColumnInfo("DicNO", 30, "民族代码"));
            comboNation.Properties.Columns.Add(new LookUpColumnInfo("DicName", 55, "民族名称"));
            comboNation.Properties.ValueMember = "DicNO";
            comboNation.Properties.DisplayMember = "DicName";
            comboNation.Properties.DataSource = dtNation;
            comboNation.Properties.NullText = "";
            #endregion

            #region 绑定政治面貌下拉列表框
            DataTable dtParty = bllCommService.GetDicDataTableByDicTableName("TB_Dic_Party");
            comboParty.Properties.Columns.Clear();
            comboParty.Properties.Columns.Add(new LookUpColumnInfo("DicNO", 30, "政治面貌代码"));
            comboParty.Properties.Columns.Add(new LookUpColumnInfo("DicName", 55, "政治面貌名称"));
            comboParty.Properties.ValueMember = "DicNO";
            comboParty.Properties.DisplayMember = "DicName";
            comboParty.Properties.DataSource = dtParty;
            comboParty.Properties.NullText = "";
            #endregion

            DataTable dtStudentsInfo = service.GetExameeByNMT_SignUpID(strNMT_SignUpID);

            if (dtStudentsInfo.Rows.Count >= 1)
            {
                strSignUpID = dtStudentsInfo.Rows[0]["SignUpID"].ToString().Trim();
                strIdentityCard = dtStudentsInfo.Rows[0]["IdentityCard"].ToString().Trim();
                txtNMT_SignUpID.Text = dtStudentsInfo.Rows[0]["NMT_SignUpID"].ToString().Trim();
                txtIdentityCard.Text = dtStudentsInfo.Rows[0]["IdentityCard"].ToString().Trim();
                txtName.Text = dtStudentsInfo.Rows[0]["Name"].ToString().Trim();
                comboExamProvince.EditValue = dtStudentsInfo.Rows[0]["ExamProvince"].ToString().Trim();
                txtRPR_Place.Text = dtStudentsInfo.Rows[0]["RPR_Place"].ToString().Trim();
                comboNation.EditValue = dtStudentsInfo.Rows[0]["Nation"].ToString().Trim();
                txtLinkTelphone.Text = dtStudentsInfo.Rows[0]["LinkTelphone"].ToString().Trim();
                comboParty.EditValue = dtStudentsInfo.Rows[0]["Party"].ToString().Trim();
                txtWorkOrStudyPlace.Text = dtStudentsInfo.Rows[0]["WorkOrStudyPlace"].ToString().Trim();
                txtParentsMobile1.Text = dtStudentsInfo.Rows[0]["ParentsMobile1"].ToString().Trim();
                txtParentsMobile2.Text = dtStudentsInfo.Rows[0]["ParentsMobile2"].ToString().Trim();
                txtLinkPostalCode.Text = dtStudentsInfo.Rows[0]["LinkPostalCode"].ToString().Trim();
                txtCertificatePostAddress.Text = dtStudentsInfo.Rows[0]["CertificatePostAddress"].ToString().Trim();
                txtDuty.Text = dtStudentsInfo.Rows[0]["Duty"].ToString().Trim();
                txtMail.Text = dtStudentsInfo.Rows[0]["Mail"].ToString().Trim();
                txtQQ.Text = dtStudentsInfo.Rows[0]["QQ"].ToString().Trim();
                txtLinkMan.Text = dtStudentsInfo.Rows[0]["LinkMan"].ToString().Trim();
                txtWeChat.Text = dtStudentsInfo.Rows[0]["WeChat"].ToString().Trim();
                txtSG.Text = dtStudentsInfo.Rows[0]["Height"].ToString().Trim();
                txtTZ.Text = dtStudentsInfo.Rows[0]["Weight"].ToString().Trim();
                txtXW.Text = dtStudentsInfo.Rows[0]["Breast"].ToString().Trim();
                txtYW.Text = dtStudentsInfo.Rows[0]["Waist"].ToString().Trim();
                txtTW.Text = dtStudentsInfo.Rows[0]["Hip"].ToString().Trim();
                txtXM.Text = dtStudentsInfo.Rows[0]["ShoeSize"].ToString().Trim();
                txtInterests.Text = dtStudentsInfo.Rows[0]["Interests"].ToString().Trim();
                txtWorks.Text = dtStudentsInfo.Rows[0]["Works"].ToString().Trim();
                txtAwards.Text = dtStudentsInfo.Rows[0]["Awards"].ToString().Trim();
                txtRemark.Text = dtStudentsInfo.Rows[0]["Remark"].ToString().Trim();
                txtXMZC.Text = dtStudentsInfo.Rows[0]["ShoeSize_ZC"].ToString().Trim();
                txtTWZC.Text = dtStudentsInfo.Rows[0]["Hip_ZC"].ToString().Trim();
                txtYWZC.Text = dtStudentsInfo.Rows[0]["Waist_ZC"].ToString().Trim();
                txtXWZC.Text = dtStudentsInfo.Rows[0]["Breast_ZC"].ToString().Trim();
                txtTZZC.Text = dtStudentsInfo.Rows[0]["Weight_ZC"].ToString().Trim();
                txtSGZC.Text = dtStudentsInfo.Rows[0]["Height_ZC"].ToString().Trim();
                txtLinkMobile.Text = dtStudentsInfo.Rows[0]["LinkMobile"].ToString().Trim();
                txtGKCJ.Text = dtStudentsInfo.Rows[0]["GKCJ"].ToString().Trim();
                txtTKCJ.Text = dtStudentsInfo.Rows[0]["TKCJ"].ToString().Trim();
                txtSH.Text = dtStudentsInfo.Rows[0]["BodyUpper_ZC"].ToString().Trim();
                txtXS.Text = dtStudentsInfo.Rows[0]["BodyLower_ZC"].ToString().Trim();

                string strSex = dtStudentsInfo.Rows[0]["Sex"].ToString().Trim();
                if (strSex == "1")
                {
                    strSex = "男";
                }
                else if (strSex == "2")
                {
                    strSex = "女";
                }
                txtSex.Text = strSex;

                txtBirth.Text = dtStudentsInfo.Rows[0]["Birth"].ToString().Trim();

            }
            DataTable dtStudentsPhoto = service.GetStudentsPhoto(strSignUpID).Tables[0];
            if (dtStudentsPhoto != null)
            {
                BoundPhoto(dtStudentsPhoto);
            }

        }
        #endregion

        #region 绑定照片
        private void BoundPhoto(DataTable dtStudentsPhoto)
        {
            if (dtStudentsPhoto.Rows.Count == 1)
            {
                if (dtStudentsPhoto.Rows[0]["Photo"] != null)
                {
                    using (MemoryStream buf = new MemoryStream((byte[])dtStudentsPhoto.Rows[0]["Photo"]))
                    {
                        Image image = Image.FromStream(buf, true);
                        picShowPhoto.Image = image;
                    }
                }
            }
        }

        #endregion

        #region 绑定报考专业信息
        private void BindSpecialityList()
        {
            DataTable dt = service.GetExameeSpeciality_ExamLevelBySignUpID_New(strSignUpID);
            if (dt != null)
            {
                //foreach (DataRow dr in dt.Rows)
                //{
                //    dr["IsPass"] = service.GetExamLog(strSignUpID, dr["SpecialityKindsNO"].ToString());
                //}
            }
            //绑定专业信息列表
            gridSpeciality.DataSource = dt;
        }
        #endregion

        #region 绑定缴费信息
        private void BindPayFeeList()
        {
            //DataTable dtPayFee = service.GetNetPayFeeInfo_BySignUpID(strSignUpID);
            //DataTable dtPayFeeDetail = null;
            //if (dtPayFee != null)
            //{
            //    foreach (DataRow dr in dtPayFee.Rows)
            //    {
            //        if (dr["IsFeeSuccess"].ToString() == "1")
            //        {
            //            dr["IsFeeSuccess"] = "成功";
            //        }
            //        else
            //        {
            //            dr["IsFeeSuccess"] = "失败";
            //        }
            //    }
            //    dtPayFeeDetail = service.GetNetPayFeeDetail_ByOrdNO(dtPayFee.Rows[0]["OrdNO"].ToString());
            //    gridPayFee.DataSource = dtPayFee;
            //}

            //if (dtPayFeeDetail != null)
            //    gridPayFeeDetail.DataSource = dtPayFeeDetail;
        }
        #endregion

        #region 绑定通知列表
        private void BindNoticeList()
        {
            //DataTable dt = serviceConsult.GetNoticeTable(strSignUpID);
            //if (dt != null)
            //{
            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        if (dr["IsRead"].ToString() == "1")
            //        {
            //            dr["IsRead"] = "是";
            //        }
            //        else
            //        {
            //            dr["IsRead"] = "否";
            //        }
            //    }
            //}
            //gridControl1.DataSource = dt;
        }
        #endregion



        #region 单击订单信息列表（查看相应的订单详情）
        private void gridView2_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            //string strOrdNO = gridView2.GetRowCellValue(e.RowHandle, gridView2.Columns["OrdNO"]).ToString();
            //gridPayFeeDetail.DataSource = service.GetNetPayFeeDetail_ByOrdNO(strOrdNO);
        }
        #endregion

        #region 检查必填项是否填写完整
        /// <summary>
        /// 检查必填项是否填写完整
        /// </summary>
        /// <returns></returns>
        private string CheckData()
        {
            if (txtNMT_SignUpID.Text.Trim() == "")
            {
                return "请填写高考报名号，谢谢！";
            }

            if (txtNMT_SignUpID.Text.Trim().Length < 10)
            {
                return "您填写的高考报名号小于10位，确认保存？";
            }

            if (txtName.Text.Trim() == "")
            {
                return "请填写姓名，谢谢！";
            }

            if (txtIdentityCard.Text.Trim() == "")
            {
                return "请填写身份证号码，谢谢！";
            }

            if (txtIdentityCard.Text.Trim().Length != 15 && txtIdentityCard.Text.Trim().Length != 18)
            {
                return "您填写的身份证号不是15位或18位，确认保存？";
            }

            if (!CheckIDCard.Check(txtIdentityCard.Text.Trim()))
            {
                return "输入的身份证号码【格式错误】，验证不通过！";
            }

            return "";
        }
        #endregion

        #region 填充数据实体
        /// <summary>
        /// 学生基本信息
        /// </summary>
        /// <returns></returns>
        private TB_SignUpStudents FillDataStudentBaseInfo()
        {
            //基本信息
            TB_SignUpStudents StudentBaseInfo = service.GetExameeByID(strSignUpID);
            StudentBaseInfo.SignUpID = strSignUpID;
            StudentBaseInfo.NMT_SignUpID = txtNMT_SignUpID.Text.Trim();
            StudentBaseInfo.Name = txtName.Text.Trim();
            StudentBaseInfo.IdentityCard = txtIdentityCard.Text.Trim();
            StudentBaseInfo.ExamProvince = comboExamProvince.EditValue.ToString().Trim();

            if (txtSex.Text.Trim() == "男")
                StudentBaseInfo.Sex = "1";
            else
                StudentBaseInfo.Sex = "2";
            StudentBaseInfo.Birth = txtBirth.Text;

            return StudentBaseInfo;
        }
        #endregion

        #region 设置输入框可用
        private void txtEnableTrue()
        {
            btnSave.Enabled = true;

            txtRPR_Place.Enabled = true;
            comboNation.Enabled = true;
            txtLinkTelphone.Enabled = true;
            comboParty.Enabled = true;
            txtWorkOrStudyPlace.Enabled = true;
            txtParentsMobile1.Enabled = true;
            txtCertificatePostAddress.Enabled = true;
            txtParentsMobile2.Enabled = true;
            txtLinkPostalCode.Enabled = true;
            txtDuty.Enabled = true;
            txtMail.Enabled = true;
            txtQQ.Enabled = true;
            txtLinkMan.Enabled = true;
            txtWeChat.Enabled = true;
            txtXM.Enabled = true;
            txtTW.Enabled = true;
            txtYW.Enabled = true;
            txtXW.Enabled = true;
            txtTZ.Enabled = true;
            txtSG.Enabled = true;
            txtInterests.Enabled = true;
            txtWorks.Enabled = true;
            txtAwards.Enabled = true;
            txtRemark.Enabled = true;
            txtXMZC.Enabled = true;
            txtTWZC.Enabled = true;
            txtYWZC.Enabled = true;
            txtXWZC.Enabled = true;
            txtTZZC.Enabled = true;
            txtSGZC.Enabled = true;
            txtLinkMobile.Enabled = true;
            txtGKCJ.Enabled = true;
            txtTKCJ.Enabled = true;
            txtSH.Enabled = true;
            txtXS.Enabled = true;
        }
        #endregion

        #region 设置输入框不可用
        private void txtEnableFalse()
        {
            btnSave.Enabled = false;

            txtRPR_Place.Enabled = false;
            comboNation.Enabled = false;
            txtLinkTelphone.Enabled = false;
            comboParty.Enabled = false;
            txtWorkOrStudyPlace.Enabled = false;
            txtParentsMobile1.Enabled = false;
            txtCertificatePostAddress.Enabled = false;
            txtParentsMobile2.Enabled = false;
            txtLinkPostalCode.Enabled = false;
            txtDuty.Enabled = false;
            txtMail.Enabled = false;
            txtQQ.Enabled = false;
            txtLinkMan.Enabled = false;
            txtWeChat.Enabled = false;
            txtXM.Enabled = false;
            txtTW.Enabled = false;
            txtYW.Enabled = false;
            txtXW.Enabled = false;
            txtTZ.Enabled = false;
            txtSG.Enabled = false;
            txtInterests.Enabled = false;
            txtWorks.Enabled = false;
            txtAwards.Enabled = false;
            txtRemark.Enabled = false;
            txtXMZC.Enabled = false;
            txtTWZC.Enabled = false;
            txtYWZC.Enabled = false;
            txtXWZC.Enabled = false;
            txtTZZC.Enabled = false;
            txtSGZC.Enabled = false;
            txtLinkMobile.Enabled = false;
            txtGKCJ.Enabled = false;
            txtTKCJ.Enabled = false;
            txtSH.Enabled = false;
            txtXS.Enabled = false;
        }
        #endregion

        #region 根据高考号获取生源地
        private string CheckNMT_SignUpID(string strNMT_SignUpID)
        {
            string strRet = "";
            try
            {
                DataTable dtArea = this.comboExamProvince.Properties.DataSource as DataTable;
                if (dtArea != null)
                {
                    if (strNMT_SignUpID.Trim().Length == 11)
                    {
                        foreach (DataRow dr in dtArea.Rows)
                        {
                            if (dr["NMT_SignUp_Len"].ToSafeString().ToSafeInt() == strNMT_SignUpID.Trim().Length)
                            {
                                strRet = dr["NativePlaceNO"].ToSafeString();
                                return strRet;
                            }
                        }
                        strRet = "650000";
                    }
                    else if (strNMT_SignUpID.Trim().Length == 10)
                    {
                        foreach (DataRow dr in dtArea.Rows)
                        {
                            if (dr["NMT_SignUp_Len"].ToSafeString().ToSafeInt() == strNMT_SignUpID.Trim().Length)
                            {
                                strRet = dr["NativePlaceNO"].ToSafeString();
                                return strRet;
                            }
                        }
                        strRet = "610000";
                    }
                    else
                    {
                        foreach (DataRow dr in dtArea.Rows)
                        {
                            string strMask = strNMT_SignUpID.Trim().Substring(dr["Index_Begin"].ToSafeString().ToSafeInt() - 1, dr["Index_End"].ToSafeString().ToSafeInt());
                            if (dr["Mask"].ToSafeString() == strMask)
                            {
                                strRet = dr["NativePlaceNO"].ToSafeString();
                                return strRet;
                            }
                        }
                    }
                }
            }
            catch
            { }
            return strRet;
        }
        #endregion

      
        #region  修改考生基本信息
        private void btnModify_Click(object sender, EventArgs e)
        {
            txtEnableTrue();

            btnSaveAdvanced.Enabled = false;
            txtNMT_SignUpID.Enabled = false;
            txtIdentityCard.Enabled = false;
            txtName.Enabled = false;
            comboExamProvince.Enabled = false;
        }
        #endregion

        #region  保存考生基本信息
        private void btnSave_Click(object sender, EventArgs e)
        {
            //基本信息
            TB_SignUpStudents StudentBaseInfo = service.GetExameeByID(strSignUpID);

            StudentBaseInfo.RPR_Place = txtRPR_Place.Text.Trim();
            if (!string.IsNullOrEmpty(comboNation.Text.Trim()))
                StudentBaseInfo.Nation = comboNation.EditValue.ToString();
            if (!string.IsNullOrEmpty(comboParty.Text.Trim()))
                StudentBaseInfo.Party = comboParty.EditValue.ToString();
            StudentBaseInfo.LinkTelphone = txtLinkTelphone.Text.Trim();
            StudentBaseInfo.WorkOrStudyPlace = txtWorkOrStudyPlace.Text.Trim();
            StudentBaseInfo.ParentsMobile1 = txtParentsMobile1.Text.Trim();
            StudentBaseInfo.CertificatePostAddress = txtCertificatePostAddress.Text.Trim();
            StudentBaseInfo.ParentsMobile2 = txtParentsMobile2.Text.Trim();
            StudentBaseInfo.LinkPostalCode = txtLinkPostalCode.Text.Trim();
            StudentBaseInfo.Duty = txtDuty.Text.Trim();
            StudentBaseInfo.Mail = txtMail.Text.Trim();
            StudentBaseInfo.QQ = txtQQ.Text.Trim();
            StudentBaseInfo.LinkMan = txtLinkMan.Text.Trim();
            StudentBaseInfo.WeChat = txtWeChat.Text.Trim();
            StudentBaseInfo.ShoeSize = txtXM.Text.Trim();
            StudentBaseInfo.Hip = txtTW.Text.Trim();
            StudentBaseInfo.Waist = txtYW.Text.Trim();
            StudentBaseInfo.Breast = txtXW.Text.Trim();
            StudentBaseInfo.Weight = txtTZ.Text.Trim();
            StudentBaseInfo.Height = txtSG.Text.Trim();
            StudentBaseInfo.Interests = txtInterests.Text.Trim();
            StudentBaseInfo.Works = txtWorks.Text.Trim();
            StudentBaseInfo.Awards = txtAwards.Text.Trim();
            StudentBaseInfo.Remark = txtRemark.Text.Trim();
            StudentBaseInfo.Height_ZC = txtSGZC.Text.Trim();
            StudentBaseInfo.Weight_ZC = txtTZZC.Text.Trim();
            StudentBaseInfo.Breast_ZC = txtXWZC.Text.Trim();
            StudentBaseInfo.Waist_ZC = txtYWZC.Text.Trim();
            StudentBaseInfo.Hip_ZC = txtTZZC.Text.Trim();
            StudentBaseInfo.ShoeSize_ZC = txtXMZC.Text.Trim();
            StudentBaseInfo.BodyUpper_ZC = txtSH.Text.Trim();
            StudentBaseInfo.BodyLower_ZC = txtXS.Text.Trim();
            StudentBaseInfo.LinkMobile = txtLinkMobile.Text.Trim();
            StudentBaseInfo.TKCJ = txtTKCJ.Text.Trim();
            StudentBaseInfo.GKCJ = txtGKCJ.Text.Trim();


            bool flag = service.SaveStudentInfo_Modify(StudentBaseInfo);

            if (flag)
            {

                DevHelper.ShowInfoMessageBox("考生信息保存成功！");
                txtEnableFalse();

            }
            else
            {
                DevHelper.ShowErrorMessageBox("考生信息保存失败！");
            }
        }
        #endregion

        #region 高级保存
        private void btnSaveAdvanced_Click(object sender, EventArgs e)
        {

            TB_SignUpStudents StudentBaseInfo = null;

            if (CheckData() != "")
            {
                DevHelper.ShowWarningMessageBox(CheckData());
                return;
            }
            else
            {
                string strRetrun = "";
                JsonMessage message = new JsonMessage();
                if (strNMT_SignUpID.Trim() != txtNMT_SignUpID.Text.Trim())
                {
                    message = bllCommService.StudentInfoModify_CheckIsRegist("", txtNMT_SignUpID.Text.Trim(), "1");
                    strRetrun = "1";
                }
                else if (strIdentityCard.Trim() != txtIdentityCard.Text.Trim())
                {
                    message = bllCommService.StudentInfoModify_CheckIsRegist(txtIdentityCard.Text.Trim(),"","0");
                    strRetrun = "0";
                }
                //else
                //{
                //    strRetrun = "1";
                //}

                //if (strRetrun == "0")
                //{
                //    DevHelper.ShowErrorMessageBox("数据库连接错误");

                //    return;
                //}
                 if (message.State=="false"&& strRetrun=="1")
                {
                    DevHelper.ShowWarningMessageBox("高考报名号被注册过");
                    return;
                }
                else if (message.State == "false" && strRetrun == "0")
                {
                    DevHelper.ShowWarningMessageBox("身份证号码被注册过");
                    return;
                }
                else
                {
                    StudentBaseInfo = FillDataStudentBaseInfo();

                    bool flag = service.SaveStudentInfo_Modify(StudentBaseInfo);

                    if (flag)
                    {
                        service.UpdatePrintAllowExamIDData_All(StudentBaseInfo.SignUpID, Environment.MachineName);

                        btnSaveAdvanced.Enabled = false;
                        txtNMT_SignUpID.Enabled = false;
                        txtIdentityCard.Enabled = false;
                        txtName.Enabled = false;
                        comboExamProvince.Properties.Enabled = false;
                        ////LoadMsgData();
                        ////Print();
                    }
                    else
                    {
                        DevHelper.ShowErrorMessageBox("考生信息保存失败");
                    }
                }
            }
        }

        #endregion
     
        #region 高级修改
        private void btnModifyAdvanced_Click(object sender, EventArgs e)

        { 
            btnSaveAdvanced.Enabled = true;
            txtNMT_SignUpID.Enabled = true;
            txtIdentityCard.Enabled = true;
            txtName.Enabled = true;
            comboExamProvince.Enabled = true;

            txtEnableFalse();
    }
        #endregion

        #region 发送消息
        TB_Notice modelNotice = null;
        private void Method()
        {
            if (modelNotice != null)
            {
                #region 推送消息
                //JPushPublicer objJPush = new JPushPublicer();
                //TB_ConsultTitle objTitle = new TB_ConsultTitle();
                //TB_ConsultReply objReply = new TB_ConsultReply();
                //objTitle.UsersID = modelNotice.SignUpID;
                //objTitle.ID = modelNotice.NoticeID;
                //objTitle.ConsultTitle = "通知公告";
                //objTitle.TypeID = ConstConsultTypeID.TZ;
                //objJPush.Push(objTitle, objReply);
                #endregion
            }
            modelNotice = null;
        }
        private void btnSendSMS_Click(object sender, EventArgs e)
        {
            //List<TB_Notice> list = new List<TB_Notice>();
            //TB_Notice notice = new TB_Notice();
            //notice.SignUpID = strSignUpID;
            //notice.NoticeType = "private";
            //notice.NoticeTitle = txtNoticeTitle.Text;
            //notice.Message = memoMessage.Text;
            //notice.IsRead = "1";
            //notice.CreateTime = DateTime.Now;
            //notice.IsActive = "1";
            //modelNotice = notice;
            //list.Add(notice);
            //if (serviceConsult.SaveNoticeList(list))
            //{
            //    Thread thread = new Thread(new ThreadStart(Method));
            //    thread.Start();
            //    BindNoticeList();
            //}
            //txtNoticeTitle.Text = "";
            //memoMessage.Text = "";
        }
        #endregion

        #region 通知列表事件
        private void gridView4_DoubleClick(object sender, EventArgs e)
        {
            //Examinee_NoticeDetail obj = new Examinee_NoticeDetail();
            //obj.strNoticeTitle = gridView4.GetFocusedRowCellValue("NoticeTitle").ToString();
            //obj.strMessage = gridView4.GetFocusedRowCellValue("Message").ToString();
            //obj.Run();
        }
        private void gridView4_MouseDown(object sender, MouseEventArgs e)
        {
            //int index = gridView4.FocusedRowHandle;

            //if (index != -1)
            //{
            //    if (e.Button == MouseButtons.Right)
            //    {
            //        if (gridView4.FocusedRowHandle >= 0)
            //        {
            //            BindNoticeList();
            //        }
            //    }
            //    else
            //    {
            //        BindNoticeList();
            //    }
            //}
        }
        private void delete_Click(object sender, EventArgs e)
        {
            //try
            //{
            //    string strId = gridView4.GetFocusedRowCellValue("NoticeID").ToString();
            //    bool flag = serviceConsult.DeleteConsultTitle(strId);
            //    if (flag)
            //        BindNoticeList();
            //}
            //catch
            //{
            //    DevHelper.ShowErrorMessageBox("删除失败");
            //}
        }
        #endregion

        #region 鼠标离开事件
        private void txtNMT_SignUpID_Leave(object sender, EventArgs e)
        {
            if (txtNMT_SignUpID.Text == "")
            {
                return;
            }
            if (txtNMT_SignUpID.Text.Trim().Length == 10 || txtNMT_SignUpID.Text.Trim().Length == 11 || txtNMT_SignUpID.Text.Trim().Length == 14)
            {
                string strYKZ = txtNMT_SignUpID.Text;
                DataTable dt = service.GetStudentsInfoByYKZ(strYKZ);
                if (dt == null || dt.Rows.Count == 0)
                {
                    string strProvice = CheckNMT_SignUpID(txtNMT_SignUpID.Text.Trim());
                    if (strProvice != "")
                    {
                        comboExamProvince.EditValue = strProvice;
                    }
                    else
                    {
                        DevHelper.ShowWarningMessageBox("高考报名号格式不正确，无法解析生源地！");
                        txtNMT_SignUpID.Text = string.Empty;
                        return;
                    }
                }
                else
                {
                    DevHelper.ShowWarningMessageBox("该高考报名号已经存在，请确认！");
                    txtNMT_SignUpID.Text = string.Empty;
                    return;
                }

            }
            else
            {
                DevHelper.ShowWarningMessageBox("高考报名号【位数】不正确！");
                txtNMT_SignUpID.SelectAll();
                txtNMT_SignUpID.Focus();
                return;
            }
        }

        private void txtIdentityCard_Leave(object sender, EventArgs e)
        {
            string strBirth = "";
            string strSex = "";

            if (txtIdentityCard.Text.Trim().Length == 18 || txtIdentityCard.Text.Trim().Length == 15)
            {
                if (txtIdentityCard.Text.Trim().Length == 18)
                {
                    strBirth = txtIdentityCard.Text.Trim().Substring(6, 4) + "-" + txtIdentityCard.Text.Trim().Substring(10, 2) + "-" + txtIdentityCard.Text.Trim().Substring(12, 2);

                    if ("13579".IndexOf(txtIdentityCard.Text.Trim().Substring(16, 1)) > -1)
                    {
                        strSex = "1";//男
                    }
                    else
                    {
                        strSex = "2";//女
                    }
                }
                else
                {
                    strBirth = "19" + txtIdentityCard.Text.Trim().Substring(6, 2) + "-" + txtIdentityCard.Text.Trim().Substring(8, 2) + "-" + txtIdentityCard.Text.Trim().Substring(10, 2);

                    if ("13579".IndexOf(txtIdentityCard.Text.Trim().Substring(14, 1)) > -1)
                    {
                        strSex = "1";
                    }
                    else
                    {
                        strSex = "2";
                    }
                }
            }
            if (strSex == "1")
                txtSex.Text = "男";
            else
                txtSex.Text = "女";
            txtBirth.Text = strBirth;

        }




        #endregion

        /*****************咨询互动*************************/

        #region 绑定来源方式
        private void BindConsultResorce()
        {
            //this.ConsultResorce.Properties.NullText = "";
            ////this.ConsultResorce.Properties.Columns.Add(new LookUpColumnInfo("Key", 30, "来源编号"));
            //this.ConsultResorce.Properties.Columns.Add(new LookUpColumnInfo("Value", 55, "来源"));
            //this.ConsultResorce.Properties.DataSource = ConstAppConfig.DicConsultResorceType.ToList();
            //this.ConsultResorce.Properties.DisplayMember = "Value";
            //this.ConsultResorce.Properties.ValueMember = "Key";
        }
        #endregion
        #region 绑定数据表格 绑定待回复区
        private void BoundMsgList(string strCondition)
        {
            //Dictionary<string, string> dicJson = new Dictionary<string, string>();
            //dicJson.Add("SignUpID", strSignUpID);
            //dicJson.Add("IsTop", checkIsTop.Checked.ToSafeString().ToLower());
            //dicJson.Add("IsStudent", ckStudent.Checked.ToSafeString().ToLower());
            //dicJson.Add("IsFee", ckIsFee.Checked.ToSafeString().ToLower());
            //dicJson.Add("ConsultResorce", ConsultResorce.EditValue.ToSafeString());
            //DataTable dt = serviceConsult.GetWaitResponseProblemTable(strSignUpID
            //                                                          ,checkIsTop.Checked.ToSafeString().ToLower()
            //                                                          ,ckStudent.Checked.ToSafeString().ToLower()
            //                                                          ,ckIsFee.Checked.ToSafeString().ToLower(), ConsultResorce.EditValue.ToSafeString());
            //int rowHandle = 0;
            //if (dt != null)
            //{
            //    dt.Columns.Add("strNO", typeof(int));
            //    for (int i = 1; i <= dt.Rows.Count; i++)
            //    {
            //        dt.Rows[i - 1]["strNO"] = i;
            //        if (dt.Rows[i - 1]["ID"].ToSafeString() == strMsgID)
            //        {
            //            rowHandle = i - 1;
            //        }
            //    }
            //    if (dt.Rows.Count > 0 && strMsgID == "")
            //    {
            //        strMsgID = dt.Rows[0]["ID"].ToSafeString();
            //        strUsersNickName = dt.Rows[0]["UsersNickName"].ToSafeString();
            //        BoundReplyList();
            //    }
            //    this.isRun = true;//开始闪烁
            //}
            //else
            //{
            //    this.isRun = false;//取消闪烁
            //}
            //dgvDisplayMsg.DataSource = dt;
            //if (strMsgID == "")
            //{
            //    this.gridView5.FocusedRowHandle = -1;
            //    this.gridView5.ClearSelection();
            //}
            //else
            //{
            //    this.gridView5.FocusedRowHandle = rowHandle;
            //    gridView5.SelectRow(rowHandle);
            //}
        }
        #endregion
        #region rtf转换为html
        /// <summary>
        /// rtf转换为html
        /// </summary>
        /// <param name="rich"></param>
        /// <returns></returns>
        public static string GetHtml(string rtf)
        {
            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
            r.OutputFormat = SautinSoft.eOutputFormat.HTML_401;
            r.ImageStyle.IncludeImageInHtml = true; //To save images inside HTML as binary data specify this property to 'true'

            r.ImageStyle.ImageFolder = @"D:\";
            r.ImageStyle.ImageSubFolder = "images";
            r.ImageStyle.ImageFileName = "picture";

            string html = r.ConvertString(rtf);

            int index = 0;

            index = html.IndexOf("<body>") + 6;

            html = html.Substring(index, html.Length - index);

            html.Replace("</body>", "");
            html.Replace("</html>", "");

            return html;
        }
        #endregion

        #region 回复区展示
        private void BoundReplyList()
        {
            //if (strMsgID.Trim() != "")
            //{
            //    ////string strCondition = strUsersNickName.Trim();
            //    string strCondition = strMsgID.Trim();
            //    DataTable dt = serviceConsult.GetReplyAreaShow(strCondition);

            //    string strTopicID = "";
            //    bool flagNewTop = true;
            //    selectStart1 = 0;
            //    richHistory.Clear();

            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        if (strTopicID != dr["ID"].ToString().Trim())
            //        {
            //            strTopicID = dr["ID"].ToString().Trim();
            //            flagNewTop = true;

            //            //新问题的分隔符
            //            AppendSeparate();

            //            string Title = "";

            //            if (dr["State"].ToString().Trim() == "1")
            //                Title = dr["CreateDate"].ToString().Trim() + "  " + dr["UsersNickName"].ToString().Trim() + "\n" + dr["ConsultTitle"].ToString().Trim();
            //            else
            //                Title = dr["CreateDate"].ToString().Trim() + "  " + dr["UsersNickName"].ToString().Trim() + "  [已删除] \n" + dr["ConsultTitle"].ToString().Trim();

            //            Append(Title, "T");

            //            if (strMsgID.Trim() == dr["ID"].ToString().Trim())
            //            {
            //                string MsgQ = dr["CreateDate"].ToString().Trim() + "  【" + dr["UsersNickName"].ToString().Trim() + "】\n" + dr["ConsultContent"].ToString().Trim();
            //                Append(MsgQ, "Q");

            //                flagNewTop = false;
            //            }
            //            else
            //            {
            //                string MsgQ = dr["CreateDate"].ToString().Trim() + "  【" + dr["UsersNickName"].ToString().Trim() + "】\n" + dr["ConsultContent"].ToString().Trim();
            //                Append(MsgQ, "QQ");

            //                flagNewTop = false;
            //            }
            //        }
            //        else
            //        {
            //            if (strMsgID.Trim() == dr["ID"].ToString().Trim())
            //            {
            //                string MsgTitleReply = dr["RCreateDate"].ToString().Trim() + "  【" + dr["RConsultUsersNickName"].ToString().Trim() + "】";
            //                string MsgA = dr["RConsultContent"].ToString().Trim();

            //                if (dr["UsersNickName"].ToString().Trim().ToUpper() == dr["RConsultUsersNickName"].ToString().Trim().ToUpper())
            //                {
            //                    Append(MsgTitleReply, "QT");
            //                    Append(MsgA, "Q");
            //                }
            //                else
            //                {
            //                    AppendTitleReply(MsgTitleReply);
            //                    Append(MsgA, "MY");
            //                }
            //            }
            //            else
            //            {
            //                string MsgTitleReply = dr["RCreateDate"].ToString().Trim() + "  【" + dr["RConsultUsersNickName"].ToString().Trim() + "】";
            //                string MsgA = dr["RConsultContent"].ToString().Trim();

            //                if (dr["UsersNickName"].ToString().Trim() == dr["RConsultUsersNickName"].ToString().Trim())
            //                {
            //                    Append(MsgTitleReply, "QQT");
            //                    Append(MsgA, "QQ");
            //                }
            //                else
            //                {
            //                    AppendTitleReply(MsgTitleReply);
            //                    Append(MsgA, "A");
            //                }
            //            }
            //        }
            //    }

            //    Resh();
            //}
        }

        private void Append(string Msg, string strQA)
        {
            //if (strQA == "T") //Title
            //{
            //    selectStart1 = richHistory.TextLength;
            //    richHistory.AppendText(Msg + Environment.NewLine + Environment.NewLine);
            //    richHistory.Select(selectStart1, richHistory.TextLength - 1);
            //    richHistory.SelectionColor = Color.Black;
            //    richHistory.SelectionIndent = 0;
            //    richHistory.SelectionRightIndent = 0;
            //    richHistory.SelectionBackColor = ColorTranslator.FromHtml("#C5D9F1");  //蓝色
            //}
            //else if (strQA == "Q") //本问题
            //{
            //    selectStart1 = richHistory.TextLength;
            //    richHistory.AppendText(Msg + Environment.NewLine + Environment.NewLine);
            //    richHistory.Select(selectStart1, richHistory.TextLength - 1);
            //    richHistory.SelectionColor = Color.Black;
            //    richHistory.SelectionIndent = 0;
            //    richHistory.SelectionRightIndent = 0;
            //    richHistory.SelectionBackColor = ColorTranslator.FromHtml("#AECA72");  //绿色
            //}
            //else if (strQA == "QQ") //不是本问题
            //{
            //    selectStart1 = richHistory.TextLength;
            //    richHistory.AppendText(Msg + Environment.NewLine + Environment.NewLine);
            //    richHistory.Select(selectStart1, richHistory.TextLength - 1);
            //    richHistory.SelectionColor = Color.Black;
            //    richHistory.SelectionIndent = 0;
            //    richHistory.SelectionRightIndent = 0;
            //    richHistory.SelectionBackColor = ColorTranslator.FromHtml("#E8E8E8");  //灰色
            //}
            //else if (strQA == "A")//本问题 提问的问题 已经回复
            //{
            //    richHistory.AppendRtf(Msg);
            //    richHistory.AppendText(Environment.NewLine);
            //}
            //else if (strQA == "QT")//提问问题的标题
            //{
            //    selectStart1 = richHistory.TextLength;
            //    richHistory.AppendText(Msg + Environment.NewLine);
            //    richHistory.Select(selectStart1, richHistory.TextLength - 1);
            //    richHistory.SelectionColor = Color.Black;
            //    richHistory.SelectionIndent = 0;
            //    richHistory.SelectionRightIndent = 0;
            //    richHistory.SelectionBackColor = ColorTranslator.FromHtml("#AECA72");  //绿色
            //}
            //else if (strQA == "QQT")//提问问题的标题
            //{
            //    selectStart1 = richHistory.TextLength;
            //    richHistory.AppendText(Msg + Environment.NewLine);
            //    richHistory.Select(selectStart1, richHistory.TextLength - 1);
            //    richHistory.SelectionColor = Color.Black;
            //    richHistory.SelectionIndent = 0;
            //    richHistory.SelectionRightIndent = 0;
            //    richHistory.SelectionBackColor = ColorTranslator.FromHtml("#E8E8E8");  //灰色
            //}
            //else
            //{
            //    richHistory.AppendRtf(Msg);
            //    richHistory.AppendText(Environment.NewLine);
            //}
        }

        private void AppendSeparate()
        {
            //string Msg = "**********************************************************************************************************" + Environment.NewLine;
            //richHistory.AppendTextAsRtf(Msg, new Font(this.Font, FontStyle.Regular), RtfColor.Green, RtfColor.Yellow);
        }

        private void AppendTitleReply(string Msg)
        {
            //selectStart1 = richHistory.TextLength;
            //richHistory.AppendText(Msg + Environment.NewLine);
            //richHistory.Select(selectStart1, richHistory.TextLength - 1);
            //richHistory.SelectionColor = Color.Black;
            //richHistory.SelectionBackColor = ColorTranslator.FromHtml("#F7B940");  //橙色
        }

        private void Resh()
        {
            //richHistory.SelectionStart = richHistory.Text.Length;
            //richHistory.ScrollToCaret();
        }
        #endregion

        #region 咨询互动发送
        private void Method2()
        {
            //DataTable dt = serviceConsult.GetConsultTitleByID(strMsgID);
            //if (dt != null && dt.Rows.Count > 0)
            //{
            //    string strUserType = dt.Rows[0]["UserType"].ToSafeString();
            //    string strNickName = dt.Rows[0]["NickName"].ToSafeString();
            //    if (strUserType == "考生")
            //    {
            //        #region 推送消息
            //        //JPushPublicer objJPush = new JPushPublicer();
            //        //TB_ConsultTitle objTitle = new TB_ConsultTitle();
            //        //TB_ConsultReply objReply = new TB_ConsultReply();
            //        //objTitle.UsersID = strNickName;
            //        //objTitle.ID = strMsgID;
            //        //objTitle.ConsultTitle = "咨询互动回复";
            //        //objTitle.TypeID = ConstConsultTypeID.ZX;
            //        //objJPush.Push(objTitle, objReply);
            //        #endregion
            //    }
            //}
        }
        private void btnSend_Click(object sender, EventArgs e)
        {
            //if (strMsgID.Trim() == "")
            //{
            //    DevHelper.ShowWarningMessageBox("请选择需要回复的问题！");
            //    return;
            //}
            //if (richSend.Text.Trim() == "")
            //{
            //    DevHelper.ShowWarningMessageBox("请填写回复信息！");
            //    return;
            //}
            //else
            //{
            //    string strSend = GetHtml(richSend.Rtf);
            //    try
            //    {
            //        bool flag = serviceConsult.SaveConsultReply_UpdateConsultTitle(strMsgID, richSend.Rtf.Replace("'", "''"),
            //            SessionerHelper.UserName, strSend.Replace("'", "''"), SessionerHelper.UserID, ConsultType.ZX);
            //        Thread thread = new Thread(new ThreadStart(Method2));
            //        thread.Start();
            //        richSend.Clear();
            //        int pageIndex = xtraTabControl1.SelectedTabPageIndex;
            //        if (pageIndex == 0)
            //        {
            //            if (gridView2.DataSource != null && gridView2.Rows.Count > 0)
            //            {
            //                ////gridView2.Rows.RemoveAt(gridView2.GetFocusedDataSourceRowIndex());
            //                strMsgID = gridView5.GetFocusedRowCellValue("ID").ToString();
            //                strUsersNickName = gridView5.GetFocusedRowCellValue("UsersNickName").ToString();
            //            }
            //        }
            //        else
            //        {
            //            if (gridView1.DataSource != null && gridView1.Rows.Count > 0)
            //            {
            //                strMsgID = gridView6.GetRowCellValue(gridView6.FocusedRowHandle, "ID").ToSafeString();
            //                strUsersNickName = gridView6.GetRowCellValue(gridView6.FocusedRowHandle, "UsersNickName").ToSafeString();
            //            }
            //        }
            //        BoundReplyList();
            //        BoundMsgList("");
            //    }
            //    catch
            //    {
            //        strMsgID = "";
            //        strUsersNickName = "";
            //        richHistory.Clear();
            //    }
            //}
        }
        #endregion

        #region 查询事件（已回复列表）
        private void btnQuery_Click(object sender, EventArgs e)
        {
            //strMsgID = string.Empty;
            //strUsersNickName = string.Empty;

            //Dictionary<string, string> dicJson = new Dictionary<string, string>();
            //dicJson.Add("SignUpID", strSignUpID);
            //dicJson.Add("IsTop", checkIsTop.Checked.ToSafeString().ToLower());
            //dicJson.Add("ConsultTitle", txtMsgTitle.Text.Trim());
            //dicJson.Add("UsersNickName", txtMsgUsersNickName.Text);
            //DataTable dt = serviceConsult.GetRepliedProblemTable(strSignUpID, checkIsTop.Checked.ToSafeString().ToLower(),"strIsFee"
            //    ,"strIsStudent","strConsultResorce" ,txtMsgTitle.Text.Trim(), txtMsgUsersNickName.Text);
            //if (dt != null)
            //{
            //    dt.Columns.Add("strNO", typeof(int));
            //    for (int i = 1; i <= dt.Rows.Count; i++)
            //    {
            //        dt.Rows[i - 1]["strNO"] = i;
            //    }
            //    strMsgID = dt.Rows[0]["ID"].ToString().Trim();
            //    strUsersNickName = dt.Rows[0]["UsersNickName"].ToString().Trim();
            //    BoundReplyList();
            //}
            //dgvDisplayReply.DataSource = dt;
        }
        #endregion
        #region 查询条件（待回复列表）
        private void checkIsTop_CheckedChanged(object sender, EventArgs e)
        {
            string strCondition = "";
            BoundMsgList(strCondition);
        }

        private void ckStudent_CheckedChanged(object sender, EventArgs e)
        {
            string strCondition = "";
            BoundMsgList(strCondition);
        }

        private void ckIsFee_CheckedChanged(object sender, EventArgs e)
        {
            string strCondition = "";
            BoundMsgList(strCondition);
        }

        private void ConsultResorce_EditValueChanged(object sender, EventArgs e)
        {
            string strCondition = "";
            BoundMsgList(strCondition);
        }
        #endregion

        #region 列表行单击事件
        private void gridView6_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            //if (gridView6.GetFocusedValue() != null)
            //{
            //    strMsgID = gridView6.GetRowCellValue(gridView6.FocusedRowHandle, "ID").ToSafeString();
            //    strUsersNickName = gridView6.GetRowCellValue(gridView6.FocusedRowHandle, "UsersNickName").ToSafeString();
            //    BoundReplyList();
            //}
        }

        private void gridView5_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            //if (gridView5.GetFocusedValue() != null)
            //{
            //    strMsgID = gridView5.GetRowCellValue(gridView5.FocusedRowHandle, "ID").ToSafeString();
            //    strUsersNickName = gridView5.GetRowCellValue(gridView5.FocusedRowHandle, "UsersNickName").ToSafeString();
            //    BoundReplyList();
            //}

        }

        private void gridView5_DoubleClick(object sender, EventArgs e)
        {
            //if (gridView5.GetFocusedValue() != null)
            //{
            //    DataTable dt = serviceConsult.GetConsultTitleByID(gridView5.GetRowCellValue(gridView5.FocusedRowHandle, "ID").ToSafeString());
            //    if (dt != null)
            //    {
            //        if (dt.Rows[0]["UserType"].ToString() == "考生")
            //        {                  
            //            TB_SignUpStudents model =service.GetExameeByID(dt.Rows[0]["NickName"].ToString());//参数待修正
            //            if (model != null)
            //            {
            //                Examinee_ExameeDetailForm obj = new Examinee_ExameeDetailForm();
            //                obj.strNMT_SignUpID = model.NMT_SignUpID;
            //                obj.Run();
            //            }
            //        }
            //    }
            //}
        }
        #endregion

        #region 鼠标右键事件（咨询互动）
        private void cSTop_Click(object sender, EventArgs e)
        {
            //string strID = gridView5.GetRowCellValue(gridView5.FocusedRowHandle, "ID").ToSafeString();
            //bool flag = serviceConsult.UpdateIsTop(strID, "1");
            //if (flag)
            //{
            //    BoundMsgList("");
            //}
            //else
            //{
            //    DevHelper.ShowErrorMessageBox("设置失败！");
            //}

        }

        private void cSNoTop_Click(object sender, EventArgs e)
        {
        //    string strID = gridView5.GetRowCellValue(gridView5.FocusedRowHandle, "ID").ToSafeString();
        //    bool flag = serviceConsult.UpdateIsTop(strID, "0");
        //    if (flag)
        //    {
        //        BoundMsgList("");
        //    }
        //    else
        //    {
        //        DevHelper.ShowErrorMessageBox("设置失败！");
        //    }
        }

        private void cSPublic_Click(object sender, EventArgs e)
        {
            //string strID = gridView5.GetRowCellValue(gridView5.FocusedRowHandle, "ID").ToSafeString();
            //bool flag = serviceConsult.UpdateIsPublic(strID, "1");
            //if (flag)
            //{
            //    gridView5.SetRowCellValue(gridView5.FocusedRowHandle, "IsPublic", "公开");
            //}
            //else
            //{
            //    DevHelper.ShowErrorMessageBox("设置失败！");
            //}
        }

        private void cSPrivate_Click(object sender, EventArgs e)
        {
            //string strID = gridView5.GetRowCellValue(gridView5.FocusedRowHandle, "ID").ToSafeString();
            //bool flag = serviceConsult.UpdateIsPublic(strID, "0");
            //if (flag)
            //{
            //    gridView5.SetRowCellValue(gridView5.FocusedRowHandle, "IsPublic", "不公开");
            //}
            //else
            //{
            //    DevHelper.ShowErrorMessageBox("设置失败！");
            //}
        }

        private void cSDelete_Click(object sender, EventArgs e)
        {
            //string strID = gridView5.GetRowCellValue(gridView5.FocusedRowHandle, "ID").ToSafeString();
            //bool flag = serviceConsult.DeleteConsultTitle(strID);
            //if (flag)
            //{
            //    BoundMsgList("");
            //}
            //else
            //{
            //    DevHelper.ShowErrorMessageBox("删除失败！");
            //}
         
        }
        #endregion
    }
}
